#blk=(256 160 128 80 64 40 32 20 )
# blk=(512 320 256 160 128 80 64)
# blk=(384 240 192 120 96 60 48 40)
#blk=(768 480 384 240 192 120 96 80)
# sblk=(10 16 20 32  40 64 80 96)
blk=(160)
sblk=(16)
file=temp.log
result_file=result.log
rm $file $result_file

for((i=0;i<1;i++))
do
  sed s/@BLK/${blk[$i]}/g makefile_temp > temp
  sed s/@SBLK/${sblk[$i]}/g temp > makefile_test_$i
  cp -f makefile_test_$i makefile
  make clean
  make dag

#  bsub -I -b -q q_sw_expr -n 1 -cgsp 64 -host_stack 1024 -share_size 6000 -o $file ./sparselu 
 bsub -I -b -n 1 -cgsp 64 -q q_sw_expr  -share_size 13000 -host_stack 1024 -cache_size 32  -o $file ./cholesky_dag
done

rm temp

echo total_graph_build >> $result_file
grep -n "total_graph_build" $file | awk {'print $2'} >> $result_file

echo total_graph_exec >> $result_file
grep -n "total_graph_exec" $file | awk {'print $2'} >> $result_file

echo total_time >> $result_file
grep -n "total_time" $file | awk {'print $2'} >> $result_file

echo pure_exec_time >> $result_file
grep -n "max_pure_time:" $file | awk {'print $6'} >> $result_file

echo task_pure_exec_time >> $result_file
grep -n "max_task_pure_time:" $file | awk {'print $6'} >> $result_file

echo mutex_file >> $result_file                                                                                                                                                              
grep -n "ain core mutex fa" ./$file | awk '{print $6}' >> $result_file
echo total_mutex >> $result_file
grep -n "re mutex success co" ./$file| awk '{print $6}' >> $result_file

  echo aver_per_task_inst >> $result_file
  grep -n "aver_per_task" $file | awk {'print $3'} >> $result_file

cat $result_file

mv $file $1_$file
mv $result_file $1_${result_file}

